package com.boco.modules.fdoc.web.sigserverpack;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.boco.common.persistence.Page;
import com.boco.common.web.ServletController;
import com.boco.modules.fdoc.service.SigServicepackService;
import com.boco.modules.fdoc.vo.ServicepackDetailsVo;
import com.boco.modules.fdoc.vo.SigServicepackVo;

@Controller
@RequestMapping(value = "/sigserverpack")
public class OpenEditSigSvsPackCtr extends ServletController {
	@Resource
	SigServicepackService sigServicepackService;
	
	@RequestMapping(value = "/openEditSigSvsPack", method = RequestMethod.POST)
	public String getSigSvsPackById(SigServicepackVo vo,HttpServletRequest request,HttpServletResponse response,Model model){
		int sigSvsPackId=vo.getId();
		if (sigSvsPackId!=0) {
			SigServicepackVo sigServicepackVo=sigServicepackService.getSigSvsPackById(sigSvsPackId);
//			System.out.println(sigServicepackVo.getPackName()+"=====================================");
			request.setAttribute("id", sigServicepackVo.getId());
			request.setAttribute("packName",sigServicepackVo.getPackName());
			request.setAttribute("packPrice", sigServicepackVo.getPackPrice());
			request.setAttribute("userPay", sigServicepackVo.getUserPay());
			request.setAttribute("orgratio", sigServicepackVo.getOrgratio());
			request.setAttribute("adviceGroup", sigServicepackVo.getAdviceGroup());
			request.setAttribute("target", sigServicepackVo.getTarget());
			request.setAttribute("remarks", sigServicepackVo.getRemarks());
			
			Page<ServicepackDetailsVo> dtsPage=new Page<ServicepackDetailsVo>(request,response);
			dtsPage = sigServicepackService.getServicePackDetailsLst(dtsPage, sigSvsPackId);
			request.setAttribute("dtsPage", dtsPage);
			return "/sigsvspack/sigsvsedit";
		}else{
			return "/sigsvspack/sigsvsedit";
		}
	}

}
